package ua.com.minus1.lookbattle.status;

import android.os.Parcel;
import android.os.Parcelable;
import ua.com.minus1.lookbattle.models.Pair;

/**
 * Created with IntelliJ IDEA.
 * User: Flash
 * Date: 04.09.12
 * Time: 14:28
 * To change this template use File | Settings | File Templates.
 */
public class BattleActivityStatus implements Parcelable {

    private Pair pair;
    private int catId;

    public BattleActivityStatus() {
    }

    public BattleActivityStatus(Parcel parcel) {
        readFromParcel(parcel);
    }

    public int describeContents() {
        return 0;
    }

    public void setStatus(Pair p, int catId) {
        pair = new Pair();
        pair.imageL = p.imageL;
        pair.imageR = p.imageR;
        pair.sessionId = p.sessionId;
        this.catId = catId;
    }

    public Pair getLastResult() {
        return pair;
    }

    public int getCatId() {
        return catId;
    }

    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeString(pair.imageL);
        parcel.writeString(pair.imageR);
        parcel.writeString(pair.sessionId);
        parcel.writeInt(catId);
    }

    public void readFromParcel(Parcel parcel) {
        Pair p = new Pair();
        p.imageL = parcel.readString();
        p.imageR = parcel.readString();
        p.sessionId = parcel.readString();
        catId = parcel.readInt();
    }

    public static final Creator CREATOR =
            new Creator<BattleActivityStatus>() {
                public BattleActivityStatus createFromParcel(Parcel parcel) {
                    return new BattleActivityStatus(parcel);
                }

                public BattleActivityStatus[] newArray(int i) {
                    return new BattleActivityStatus[i];
                }
            };

}
